/*
* @Author: sc
* @Date:   2019-01-07 16:25:29
* @Last Modified by:   sc
* @Last Modified time: 2019-01-20 12:55:23
*/
import { message} from 'antd';

class Util{
	request(param){
		return new Promise((resolve, reject) => {
			$.ajax({
				type     	: param.type 		|| 'get',
				url    	  	: param.url  		|| '',
				dataType 	: param.dataType 	|| 'json',
				data     	: param.data 		|| null,
				success		: res =>{
					// 数据请求成功
					typeof resolve === 'function' && resolve(res, res.msg);
	
				},
				error   	 : err =>{
					typeof reject === 'function' && reject(err);
				}
			});
		})
	}
	errTips(msg){
		message.error(msg);
	}
	
}

export default Util;